phse = input()
br_open = "([{<"
br_close = ")]}>"
ms = []
br_match = True
for char in phse:
    if char in br_open:
        ms.append(char)
    if char in br_close:
        if len(ms) == 0 or br_close.find(char) != br_open.find(ms.pop()):
            br_match = False
            break

if len(ms) == 0 and br_match:
    print("Верная")
else:
    print("Неверная")

print(len(ms)== 0 and br_match)
